Conversation
WalkthroughОбновлена система клонирования с изменением логики вероятностного выхода в методе GetSpawnEntity для случаев без истинного клонирования, добавлена новая конфигурация базового шанса гуманоидности к машине метемпсихоза и расширен список видов в пуле взвешенной случайности с переуведомлением приоритетов. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@Content.Server/Cloning/CloningSystem.cs`:
- Around line 376-388: The early-return logic under
ForcedMetempsychosisType.None double-samples the same probability (via the two
_random.Prob calls around the cloneChance and the later _random.Prob(chance)),
causing the effective humanoid probability to be chance*chance; fix by
performing a single draw or by using a separate humanoid-selection parameter:
compute cloneChance = 1.0f - Math.Clamp(chance,0,1) and do one
_random.Prob(cloneChance) to decide cloning, otherwise use a single separate
humanoidRollChance (e.g., HumanoidSelectionChance or a local humanoidChance =
Math.Clamp(chance,0,1)) to choose humanoid without reusing the same random call,
updating the branches that reference ev.NeverTrulyClone, changeProfile and
returns (refer to ForcedMetempsychosisType.None, ev.NeverTrulyClone,
cloneChance, chance, and the two _random.Prob calls) so the final humanoid
probability equals the intended parameter.
| switch (ev.ForcedType) | ||
| { | ||
| case ForcedMetempsychosisType.None: | ||
| if (!ev.NeverTrulyClone | ||
| && chance > 1 | ||
| && _random.Prob(chance - 1)) | ||
| if (!ev.NeverTrulyClone) | ||
| { | ||
| changeProfile = false; | ||
| return oldSpecies.Prototype; | ||
| var cloneChance = 1.0f - Math.Clamp(chance, 0, 1); | ||
|
|
||
| if (_random.Prob(Math.Clamp(cloneChance, 0, 1))) | ||
| { | ||
| changeProfile = false; | ||
| return oldSpecies.Prototype; | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
wc -l Content.Server/Cloning/CloningSystem.csRepository: WWhiteDreamProject/wwdpublic
Length of output: 115
🏁 Script executed:
sed -n '350,420p' Content.Server/Cloning/CloningSystem.csRepository: WWhiteDreamProject/wwdpublic
Length of output: 2627
🏁 Script executed:
sed -n '1,50p' Content.Server/Cloning/CloningSystem.csRepository: WWhiteDreamProject/wwdpublic
Length of output: 1768
🏁 Script executed:
# Check git history for this method to understand if this is recent change
git log --oneline -20 -- Content.Server/Cloning/CloningSystem.csRepository: WWhiteDreamProject/wwdpublic
Length of output: 114
🏁 Script executed:
# Search for any tests related to this cloning logic
find . -name "*.cs" -type f | xargs grep -l "GetSpawnEntity\|MetempsychoticHumanoidPool" | head -20Repository: WWhiteDreamProject/wwdpublic
Length of output: 924
🏁 Script executed:
# Check if there are any related configuration values or comments about the probability
rg "HumanoidBaseChance|MetempsychoticHumanoidPool" -A 3 -B 3Repository: WWhiteDreamProject/wwdpublic
Length of output: 3734
Уточните распределение вероятностей в логике раннего возврата.
При ForcedMetempsychosisType.None вероятность гуманоида сокращается с chance до chance * chance из-за двух последовательных проверок на одну переменную:
- Первая:
_random.Prob(1.0f - clampedChance)для выхода с клоном (строка ~378) - Вторая:
_random.Prob(chance)для выбора гуманоида (строка ~383)
При текущей конфигурации (HumanoidBaseChance = 0.8) вероятность гуманоида составляет 0.8 × 0.8 = 0.64 вместо ожидаемых 0.8. Подтвердите, что такое сокращение вероятности намеренно, или используйте отдельный параметр для выбора гуманоида.
🤖 Prompt for AI Agents
In `@Content.Server/Cloning/CloningSystem.cs` around lines 376 - 388, The
early-return logic under ForcedMetempsychosisType.None double-samples the same
probability (via the two _random.Prob calls around the cloneChance and the later
_random.Prob(chance)), causing the effective humanoid probability to be
chance*chance; fix by performing a single draw or by using a separate
humanoid-selection parameter: compute cloneChance = 1.0f -
Math.Clamp(chance,0,1) and do one _random.Prob(cloneChance) to decide cloning,
otherwise use a single separate humanoidRollChance (e.g.,
HumanoidSelectionChance or a local humanoidChance = Math.Clamp(chance,0,1)) to
choose humanoid without reusing the same random call, updating the branches that
reference ev.NeverTrulyClone, changeProfile and returns (refer to
ForcedMetempsychosisType.None, ev.NeverTrulyClone, cloneChance, chance, and the
two _random.Prob calls) so the final humanoid probability equals the intended
parameter.
This reverts commit 5baa642.
Описание PR
У меня чёт вылетала локалка из-за метеопсиопной машинки, ну я ей циферки покрутил немного
и добавил побольше рас для псиопа, весело же
Медиа
Список
Изменения
🆑